package tuanda.soict.firstsun.BuildingPackage;

import tuanda.soict.firstsun.AbilityPackage.Ability;
import tuanda.soict.firstsun.LogicPackage.AI_Part;
import tuanda.soict.firstsun.LogicPackage.Army;

/**
 * @author tuanda_soict_hut
 * @version 0.0.1
 * @since 5-8-2012
 */
public class Army_Building extends HP_Building {

    int armyProduceType;
    int distance;

    public Army_Building(String nam, int def, int id, int groID,
            int obsPoint, int typ, int goldProd, int hp, int armyProduce, int x, int y, int dataID) {
        super(nam, def, id, groID, obsPoint, typ, goldProd, hp, x, y, dataID);
        setArmyProduceType(armyProduce);
        setDistance(0);
    }

    public Army produceArmy(String nam, int groupID, int ran, int typ,
            int minAtk, int maxAtk, int def, int mov, int range, int gold,
            int x, int y, int dataID, Ability[] ability, int attr, AI_Part ai_part) {
        return ai_part.addNewArmy(nam, groupID, ran, typ, minAtk, maxAtk,
                def, mov, range, gold, x, y, dataID, ability, attr);
    }

    public final int getArmyProduceType() {
        return this.armyProduceType;
    }

    public final void setArmyProduceType(int armyType) {
        if (armyType >= SEA_TYPE && armyType <= AIR_TYPE) {
            this.armyProduceType = armyType;
        } else {
            this.armyProduceType = LAND_TYPE;
        }
    }

    public final int getDistance() {
        return this.distance;
    }

    public final void setDistance(int dis) {
        if (dis > -1) {
            this.distance = dis;
        }
    }

    @Override
    public int getBuildingType() {
        return PRODUCE_ARMY_TYPE;
    }
}
